/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jmenu.gui;

/**
 *
 * @author sevcik.roman
 */
public class AmountSpinner extends javax.swing.JSpinner
{
    public AmountSpinner()
    {
        super();
        addChangeListener(new javax.swing.event.ChangeListener()
        {
            public void stateChanged(javax.swing.event.ChangeEvent evt)
            {
                StateChanged(evt);
            }
        });

    }

    private void StateChanged(javax.swing.event.ChangeEvent evt)
    {
        if(Integer.parseInt(getValue().toString()) < 0)
        {
            this.setValue(0);
        }
        else
        {
           if(Integer.parseInt(getValue().toString()) > 1000)
           {
                this.setValue(1000);
           }
        }
    }
}